import 'package:flutter_test/flutter_test.dart';
import 'package:df_ronda_printer/df_ronda_printer.dart';
import 'package:df_ronda_printer/df_ronda_printer_platform_interface.dart';
import 'package:df_ronda_printer/df_ronda_printer_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockDfRondaPrinterPlatform
    with MockPlatformInterfaceMixin
    implements DfRondaPrinterPlatform {
  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<String> closeDevice() {
    throw UnimplementedError();
  }

  @override
  Future<String> connectDevice(String printAddr) {
    throw UnimplementedError();
  }

  @override
  Future<void> printAscii(String printString) {
    throw UnimplementedError();
  }
}

void main() {
  final DfRondaPrinterPlatform initialPlatform =
      DfRondaPrinterPlatform.instance;

  test('$MethodChannelDfRondaPrinter is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelDfRondaPrinter>());
  });

  test('getPlatformVersion', () async {
    DfRondaPrinter dfRondaPrinterPlugin = DfRondaPrinter();
    MockDfRondaPrinterPlatform fakePlatform = MockDfRondaPrinterPlatform();
    DfRondaPrinterPlatform.instance = fakePlatform;

    expect(await dfRondaPrinterPlugin.getPlatformVersion(), '42');
  });
}
